home *** CD-ROM | disk | FTP | other *** search
/ Programmer Power Tools / Programmer Power Tools.iso / progjrn / pj_7_3a.arc / POINT.CLS < prev    next >
Text File  |  1989-02-22  |  816b  |  38 lines

  1. // point.cls    a Point class.  defines an x,y coordinate point
  2. //
  3. // x,y mapped: (like saying x=row, y=col)
  4. //
  5. // 0,0 +---------- y ->
  6. //     |
  7. //     |
  8. //     x
  9. //     |
  10. //
  11. // (c) Aspen Scientific 1989. All Rights Reserved.
  12. // Author: Vaughn Vernon
  13.  
  14. #ifndef _POINT_CLASS
  15.  
  16. # define _POINT_CLASS    1
  17.  
  18. // Point class
  19.  
  20. class Point {
  21.     int    xc, yc;
  22. public:
  23.     int    x()        { return xc; }
  24.     int    y()        { return yc; }
  25.     int    x(int xx)    { return (xc = xx); }
  26.     int    y(int yy)    { return (yc = yy); }
  27.  
  28.     Point & operator=(Point & p) { xc = p.xc; yc = p.yc; return *this; }
  29.     Point & operator()(int xx, int yy) { xc = xx; yc = yy; return *this; }
  30.     int    operator==(Point & p) { return (xc == p.xc && yc == p.yc); }
  31.     virtual void draw()    { }
  32.  
  33.     Point(int xx =0, int yy =0)    { xc=xx; yc=yy; }
  34.     ~Point()        { }
  35. };
  36.  
  37. #endif
  38.